-
Notifications
You must be signed in to change notification settings - Fork 481
Update BindablePropertySourceGenerator to use partial properties #2835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the BindablePropertySourceGenerator to utilize C#'s partial properties feature, transitioning from class-level to property-level attribute application. The change modernizes the code generation pattern by allowing developers to declare bindable properties directly on partial properties rather than using class-level attributes.
Key changes:
- Modified the BindablePropertyAttribute to target properties instead of classes
- Updated the source generator to process property-level attributes and generate corresponding BindableProperty fields
- Refactored the Expander class to demonstrate the new partial property syntax
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Expander.shared.cs | Converted class-level BindableProperty attributes to partial property declarations with property-level attributes |
| AttributeExtensions.cs | Enhanced constructor argument handling to support optional parameters with placeholders |
| BindablePropertyAttributeSourceGenerator.cs | Completely refactored to process property-level attributes and generate code for partial properties |
src/CommunityToolkit.Maui.SourceGenerators.Internal/BindablePropertyAttributeSourceGenerator.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.SourceGenerators.Internal/BindablePropertyAttributeSourceGenerator.cs
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
TheCodeTraveler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome!! Thanks Pedro!
Description of Change
Linked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information